package com.miracle9.game.util;

import com.miracle9.game.service.AdminService;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

@Service("myApplicationContext")
public class MyApplicationContext implements ApplicationContextAware
{
  private Logger logger = Logger.getLogger(MyApplicationContext.class);
  private static ApplicationContext bR;
  
  public void setApplicationContext(ApplicationContext context)
    throws BeansException
  {
    bR = context;
    b();
    editionDescription();
  }
  
  public static ApplicationContext a()
  {
    return bR;
  }
  
  public void editionDescription()
  {
    Properties pro = new Properties();
    try
    {
      pro.load(new InputStreamReader(AdminService.class.getClassLoader().getResourceAsStream("url.properties"), "UTF-8"));
      String strEditionDescription = pro.getProperty("editionDescription");
      this.logger.error(strEditionDescription);
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
  }
  
  private void b() {}
}
